import request from "@/utils/request.js";

// 根据名称获取JSON
export function getTemplatePage(data) {
    return request({
        url: `movie/api/movie/template/page`,
        method: 'post',
        data
    })
}

export function addTemplate(data) {
    return request({
        url: `movie/api/movie/template`,
        method: 'post',
        data
    })
}

export function updateTemplate(id , data) {
    return request({
        url: `movie/api/movie/template/${id}`,
        method: 'put',
        data:data
    })
}

export function deleteTemplate(id, data) {
    return request({
        url: `movie/api/movie/template/${id}`,
        method: 'delete',
        data:data
    })
}

export function toggleTemplateStatus(id, enabled) {
    return request({
        url: `movie/api/movie/template/${id}/status?enabled=${enabled}`,
        method: 'put'
    })
}

export function batchDeleteTemplates(ids) {
    return request({
        url: `movie/api/movie/template/batch/delete`,
        method: 'post',
        data: ids  // 直接传递数组
    })
}

export function batchToggleStatus(ids, enabled) {
    return request({
        url: `movie/api/movie/template/batch/toggle?enabled=${enabled}`,
        method: 'post',
        data: ids  // 直接传递数组
    })
}